<?php
//这是用户操作模块

class users extends spController
{
	function __construct(){ // 公用
		parent::__construct(); // 这是必须的
		$system = spClass("system");
		$sys=$system->findAll();
		$this->tpl_title = $sys[0][name];
		$this->email = $_SESSION["userinfo"]["mail"];
	}
	
	function u_psd()
	{
		$user=spClass('user');
		//dump($record->select());
		$conditions= array
		(
			"userid" => $_SESSION["userinfo"]["userid"],
		);
		$list = $user->findall();
		//dump($list);
		
		$this->list=$list;
		$this->display("member/user_edit.html");		
	}
	function user_edit()
	{
		$data = $this->spArgs();
		$user = spClass('user');
		$where = array(
			userid => $data['userid']
		);		
		if($user->update ( $where, $data ))
		{
			$this->success('修改成功', spUrl("users","u_psd"));
		}else 
		{
			$this->error('修改失败', spUrl("users","u_psd"));
		}
	}
	function alarm()
	{
		$alarm = spClass('alarm');
		$list = $alarm->findall();
		dump($list);
		$t = array_count_values($list);
		dump($t);
	}
}	